import request from '@/utils/request'

const productApi = {
	// 供应商及供应链自营商品列表
	getSelfProductList: (params) => {
		return request({
			url: '/product/spu/page',
			method: 'GET',
      params
		})
	},
	// 直供商品列表
	getSupplyProductList: (params) => {
		return request({
			url: '/product/spu/getSpuTenantPage',
			method: 'GET',
      params
		})
	},
  // 商品总体统计数据
  getProductStaByHome: (params) => {
		return request({
      url: '/scmReport/sjtjxx',
      method: 'GET',
      params
    })
	},
  // 商品状态统计数据
  getProductStaByStatus: (params) => {
		return request({
      url: '/product/spu/get-count',
      method: 'GET',
      params
    })
	},
	// 商品详情
	getProductDetail: (productId) => {
		return request({
			url: `/product/spu/get-detail?id=${productId}`,
			method: 'GET'
		})
	},
	// 取消上架申请
	cancelRelease: (productId) => {
		return request({
			url: `/product/spu/withdraw?spuId=${productId}`,
			method: 'PUT',
		})
	},
	// 商品上架审核
	doAudit: (data) => {
		return request({
			url: '/product/spu/doAudit',
			method: 'POST',
			data: data,
		})
	},
	// 下架和移除：0=下架，1=上架，-1=移除，2=取消上架申请
	removeProduct: (data) => {
		return request({
			url: '/product/spu/update-status',
			method: 'PUT',
			data
		})
	},
}
export default productApi